#include "charclass.h"

CharClass* CharClass::getComplement(){
    return new ReverseCharClass(p,this);
}
CharClass* CharClass::getUnion(CharClass* other){
    return new UnionCharClass(p,this,other);
}
CharClass* CharClass::getIntersecion(CharClass* other){
    return new IntersectCharClass(p,this,other);
}

CharClass* CharClass::space(Pattern* p){
    return new DiscreteCharClass(p," \t\n\r\f\v");
}

CharClass* CharClass::digit(Pattern* p){
    return new RangeCharClass(p,'0','9');
}

CharClass* CharClass::word(Pattern* p){
    CharClass* l = new RangeCharClass(p,'a','z');
    return l->getUnion(new RangeCharClass(p,'A','Z'))->getUnion(digit(p));
}
